{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

<label
  data-test-stepper-label
  for="stepper-input-{{this.elementId}}"
  class="stepper-input-label"
>{{yield}}</label>
<input
  data-test-stepper-input
  type="number"
  min={{this.min}}
  max={{this.max}}
  value={{this.internalValue}}
  disabled={{this.disabled}}
  id="stepper-input-{{this.elementId}}"
  class="stepper-input-input"
  onFocus={{action "selectValue"}}
  onKeyUp={{action "resetTextInput"}}
  onChange={{action "setValue"}}
/>
<button
  data-test-stepper-decrement
  role="button"
  aria-label="decrement"
  class="stepper-input-stepper button {{this.class}}"
  disabled={{or this.disabled (lte this.internalValue this.min)}}
  onclick={{action "decrement"}}
  type="button"
>
  <Hds::Icon @name="minus" />
</button>
<button
  data-test-stepper-increment
  role="button"
  aria-label="increment"
  class="stepper-input-stepper button {{this.class}}"
  disabled={{or this.disabled (gte this.internalValue this.max)}}
  onclick={{action "increment"}}
  type="button"
>
  <Hds::Icon @name="plus" />
</button>
